from Structure import Stack

# 栈实现十进制转二进制
def divideBy2(decNumber):
    remstack = Stack()

    while decNumber > 0:
        rem = decNumber % 2 # 求余
        remstack.push(rem)
        decNumber = decNumber // 2 # 取整除，向下取整

    binString = ""
    while not remstack.isEmpty():
        binString = binString + str(remstack.pop())
    
    return binString

decnumber = 2
binnumber = divideBy2(decnumber)
print(binnumber)